
		
		<%= render 'public/flash_notice' %>

  		<%= link_to '新增', new_cpanel_category_path, :class => "btn btn-primary", remote: true %>

  		<div id="module_win">
  			
  		</div>

    	<table id="categories" class="table table-striped">
    		<thead>
				<tr>
					<th><%= check_box_tag 'checkbox_all' %></th>
					<th>ID</th>
					<th>分类名</th>
					<th>描述</th>
					<th>是否可用</th>
					<th>创建时间</th>

					<td>操作</td>
				</tr>
			</thead>
    		
    		<tbody>
    			<% @categories.each do |category| %>
				<tr>
					<td><%= check_box_tag 'checkbox_name', category.id %></td>
					<td><%= category.id %></td>
					<td><%= category.name %></td>
					<td><%= truncate category.description, :length => 10 %></td>
					<td>
						<% if category.is_use %>
							可用
						<% else %>
							不可用
						<% end -%>
					</td>
					<td><%= format_datetime category.created_at,'%Y-%m-%d %H:%M' %></td>

					<td>
						<%= link_to '查看', cpanel_category_path(category), remote: true %>
						<%= link_to '修改', edit_cpanel_category_path(category), remote: true %>
						
						<%= link_to '删除', [:cpanel, category], confirm: '确认删除吗？', method: :delete %>
						<% if category.is_use %>
							<%= link_to '置为不可用', change_use_cpanel_category_path(category) %>
						<% else %>
							<%= link_to '置为可用', change_use_cpanel_category_path(category) %>
						<% end %>
					</td>
				</tr>
				<% end -%>
			</tbody>
    		
		</table>
		<div class="paginate-right-position">
			<%= will_paginate @categories, :previous_label =>'上一页', :next_label => '下一页' %>
		</div>
